20. Edit the Expense Claim Form (Originator State)

Now that you have the workflow steps in place, you will return to the Expense Claim Form. In the next four topics, you will dive into rules and states. There are five states to this application: (Base State), Originator State, Claim Approval State, Originator Rework State, and Finance Processing State. Each state has its own set of rules that control the configuration and behavior of the Expense Claim Form for a specific workflow Task step. For example, the Originator State is the form's configuration and behavior for the expense claim requester when they first submit the claim. The Claim Approval State is the configuration and form behavior the claim approver sees, and so forth.

A state represents the configuration and behavior of a form for a specific use. States are generally configured for a (user) Task step. For example, a request approver's form may have form fields disabled because as the approver, they do not need to change any form field values. A form used for rework will have the same fields enabled, because the workflow originator needs to update those form field values. Rather than creating two separate forms, you can use different States for each step, then use rules to control how the same form should behave in each of those two states.

Begin by editing the rules for the Originator State. You will make two controls read-only, then map a value for the Folio.

  1. Edit the Expense Claim Form. From the RULES screen, edit the form initializing rule using the table below as a guide. If a setting is not specified, assume the default value. If you need help, expand the "Show me how..." section.
    RuleConfigureNotes

    Rule
    (Edit) When the Form is Initializing

    Condition
    (None)

    Action
    (New) Specify edit state for View and Form controls

    Read-Only Expense Claim Header View Controls:
    • Approval Date
    • Approvers Comments
    • Finance Process Date
    • Finance Comments
    The first user interaction with the Expense Claim Form is the originator submitting their request. The originator does not enter values into the approver or finance comment text area boxes. You will disable these controls so they are not available to the originator. As an alternative, you could hide these controls and their labels in this state.
    1. From the K2 Designer categories screen, right-click the Expense Claim Form and select Edit. Click the RULES tab in the breadcrumb bar. In the left column are the available states for the workflow/form. As you click through the states, the rules attached to the states appear on the right side of your screen. You can add, edit, and remove rules for each state, making the state unique from the others.
      Notice there is no state for the Finance Processing (Task) step. Recall when you stepped through the form wizard for the originator and claim approver Task steps in your workflow. You created new states for each Task step. These are the states you see in the image below. Now recall that you selected the "I will do it myself later" option when configuring the Finance Processing step. This is why you do not see a Finance Processing state.

      Edit Rules and States
    2. Select the Originator State (Default). The first rule edit renders the Approver Comments and Finance Comments text area boxes read-only. You do not want the claim requester entering any values in these fields. Select the When the Form is Initializing rule, then click the Edit Rule button. (The form initializing rule is the behavior of the form when it first loads.)
      Edit Form Initializing Rule
    3. Now you can add a new action to this rule. Click the Actions tab to make it active (if it is not already). Enter
      edit state
      in the search text box, then click Specify edit state for View and Form controls to add it to the rule definition pane. Click (configure).
      Add Action to Rule Definition Pane
    4. Locate the Expense Claim Header View controls, then select READ-ONLY for the Approval Date, Approver Comments Text Area, Finance Process Date, and Finance Processing Text Area. Click OK to save the action. Click OK to save the rule.
      Read-Only View Controls
  2. Next, you will set the Folio. The workflow "folio" is often used to distinguish one workflow instance from another, is typically a human-readable unique value, and is especially useful when working with reports. Edit the When Button Submit is Clicked rule (for the Originator State (Default)), then configure the rule using the table below as a guide. If a setting is not specified, assume the default value. If you need help, expand the "Show me how..." section.
    RuleConfigureNotes

    Rule
    (Edit) When Button Submit is Clicked

    Condition
    (None)

    Action
    (Edit) then start the Expense Claim workflow Workflow

    Set Folio:
    Map the Context Browser > Expense Claim Header View > Controls > Request Title Text Box to the Folio property.
    The Folio is often a unique value used to distinguish one process instance from another. This is especially useful when working with reports.
    1. Now you will set the workflow Folio value. From the RULES screen, edit the When Button Submit is Clicked rule for the Originator State (Default).
      Edit Rule
    2. You don't need a new action to set the folio, you can edit an existing action instead. In the rule definition pane, locate the then start the Expense Claim Workflow action, then click (configure). You can set the folio with this action.
      Edit Action
    3. You will map the Request Title Text Box control over to the Folio property. At runtime, the value that the originator enters for the Request Title becomes the workflow folio.
      Expand the Context Browser > Expense Claim Form > Expense Claim Header View > Controls nodes. Drag the Request Title Text Box control into the Folio property. Click FINISH to save and exit this action setting. Click OK to save the rule.
      Map Folio Value
Review

In this step, you began working with states and rules. States represent the form's configuration and behavior for a specific use. Often, this is in conjunction with a workflow Task step. The Expense Claim Form has five states: (Base State), Originator State, Claim Approval State, Originator Rework State, and Finance Processing State. The Originator State is the form configuration and behavior that the originator, or claim requester, experiences. Here, you made the approver and finance comments fields read-only, as you don't want the requester entering anything into those fields. You also configured the Folio to be the claim title. The Folio distinguishes one workflow instance from another and is useful when working with reports. In the next step, you work with the Claim Approval State rules.

Next Step: 21. Edit the Expense Claim Form (Claim Approval State)